package Managers;

import Entities.Category;
import Tools.DatabaseException;
import org.w3c.dom.Document;

import java.util.List;

/**
 * Created by Oliver Mrazik on 10. 5. 2014.
 * author: Oliver Mrazik
 * version: 2014-05-10
 */
public interface CategoryManager {

    /**
     * Creates new category record.
     * @param category category to be created
     * @throws Tools.DatabaseException when error occurs while creating category
     */
    public void createCategory(Category category) throws DatabaseException;

    /**
     * Deletes existing category.
     * @param category category to be deleted
     * @throws Tools.DatabaseException when error occurs while deleting category
     */
    public void deleteCategory(Category category) throws DatabaseException;

    /**
     * Update existing category.
     * @param category category to be updated
     * @param newName new name for category
     * @throws Tools.DatabaseException when error occurs while renaming category
     */
    public void renameCategory(Category category, String newName) throws DatabaseException;

    /**
     * Returns concrete category by id.
     * @param id category's id
     * @return found category
     * @throws Tools.DatabaseException when error occurs while returning category
     */
    public Category getCategoryById(String id) throws DatabaseException;

    /**
     * Returns concrete category by name.
     * @param name category's name
     * @return found category
     * @throws Tools.DatabaseException when error occurs while returning category
     */
    public Category getCategoryByName(String name) throws DatabaseException;

    /**
     * Returns list of all categories.
     * @return list of categories
     * @throws Tools.DatabaseException when error occurs while gathering all categories
     */
    public List<Category> listAllCategories() throws DatabaseException;

    /**
     * Returns XMLDocument of mediums inside category.
     * @param id desired category
     * @return XMLDocument
     * @throws Tools.DatabaseException when error occurs while creating document for category
     */
    public Document getCategoryAsXMLDocument(String id) throws DatabaseException;
}
